package com.qf.fallback;

import com.qf.feign.GoodsFeign;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @version v1.0.0
 * @Description:
 * @author: 姜红凯
 * @date: 2022.03.16
 * @since 1.0
 */
@Component
public class GoodsFallbackFactory implements FallbackFactory<GoodsFeign> {

    @Autowired
    GoodsFallback goodsFallback;

    /**
     *
     * @param throwable （cause） 被调用方 出现的异常对象
     * @return
     */
    @Override
    public GoodsFeign create(Throwable throwable) {
        throwable.printStackTrace();
        return goodsFallback;
    }
}
